//定时任务
import redisDB from '../utils/redisconf'
import {
  GETNUM,
  GROUPBY
} from '../maps/corn.js'
import { sqlMain } from '../utils/dbconf'
import { scheduleJob } from 'node-schedule'
export const CORN_MAIN = async () =>{
  console.log("----定时分析任务触发----")
  const { usernum } = await sqlMain(GETNUM.usernum,[],true)
  const { ctnum } = await sqlMain(GETNUM.ctnum,[],true)
  const { hisctnum } = await sqlMain(GETNUM.hisctnum,[],true)
  await redisDB.set(4,"usernum",{usernum})
  await redisDB.set(4,"ctnum",{ctnum})
  await redisDB.set(4,"hisctnum",{hisctnum})
  // await redisDB.set(4,"num",{usernum,ctnum,hisctnum})
  // console.log("获取总人数!",{usernum,ctnum,hisctnum})
}
export const CORN_ING = async (time) => {
scheduleJob(time,CORN_MAIN)
}
